package com.cmxh.cloundnote.mapper;

import com.cmxh.cloundnote.pojo.Upwd;
import com.cmxh.cloundnote.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author Sair
 * @description 针对表【user(用户表)】的数据库操作Mapper
 * @createDate 2025-03-12 20:14:03
 * @Entity com.cmxh.cloundnote.pojo.User
 */
public interface UserMapper {
    /**
     * 添加用户

     */
    @Insert("insert into user(username,password) values(#{username},#{password})")
    int saveUser(User user);
/**查询**/
    @Select("select * from user where username=#{name}")
    User findUsesByUname(String name);
/**修改密码**/
    @Update("update user set password = #{password} where id = #{id}")
    int updatePassword(Upwd user);
/**修改昵称和邮箱**/
    @Update("update user set nickname = #{nickname},email = #{email} where id = #{id}")
    int updateUser(User user);

/**上传头像**/
    @Update("update user set user_pic = #{userPic} where id = #{id}")
    int tx(User user);
}
